package com.xinchao.api;

import com.xinchao.exception.ServiceException;
import com.xinchao.service.AdvertisementMonitorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 广告监播
 *
 * @author dxy
 * @date 2018/11/13 17:17
 */
@Controller
@RequestMapping(value = "/monitor")
public class AdvertisementMonitorController {
	@Autowired
	private AdvertisementMonitorService advertisementMonitorService;

	private static Logger logger = LoggerFactory.getLogger(AdvertisementMonitorController.class);

	/**
	 * 广告监播总览
	 */
	@ResponseBody
	@RequestMapping(value = "/overview")
	public Object overview(String advertisementName) {
		try {
			return advertisementMonitorService.getOverviewAdvertisement(advertisementName);
		} catch (ServiceException e) {
			logger.error("AdvertisementMonitorController overview 获取广告列表列表失败：" + e.getMessage());
			return e;
		}
	}
}
